var getTableId = function (tagName) {
    var tableJSONs = JSON.parse(igrx.getSql("select table_id, tag_name from log_toc", {
        dbgroup: "mssql",
        offset: 0,
        limit: -1,
        skip: 0,
        outfmt: "json"
    }));
    for (var i = 0; i < tableJSONs.length; i++) {
        if (tableJSONs[i].tag_name == tagName) {
            strRtn = tableJSONs[i].table_id;
        }
    }
    return strRtn;
}
var getWeekAxis = function () {
    let rtnArray = [];
    var dateObj = new Date(new Date().getTime() - 144* 60 * 60 * 1000);
    for (var i = 0; i < 7; i++) {
        var month = dateObj.getMonth() + 1;
        var date = dateObj.getDate();
        if (date < 10) {
            date = '0' + date;
        }
        rtnArray.push(month + '-' + date);
        dateObj = new Date(dateObj.getTime() + 24 * 60 * 60 * 1000);
    }
    return rtnArray;
}
var getHourAxis = function() {
    let rtnArray = [];
    var dateObj = new Date(new Date().getTime() - 60 * 60 * 1000);
    for (var i = 0; i < 60; i++) {
        var hour = dateObj.getHours();
        var minute = dateObj.getMinutes();
        if (minute < 10) {
            minute = '0' + minute;
        }
        rtnArray.push(hour + ':' + minute);
        dateObj = new Date(dateObj.getTime() +  60 * 1000);
    }
    return rtnArray;
}